From 6b838a22d1e55ed50d079f7a7eca8afdd3714ddc Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 13 Feb 2002 17:48:01 +0000 Subject: [PATCH] g_warning() if setting the local fails, like gdk_set_locale() did. Wed Feb 13 12:41:44 2002 Owen Taylor * gtk/gtkmain.c (gtk_init_check): g_warning() if setting the local fails, like gdk_set_locale() did. * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): Don't free local_list if local_count == 0. (#71241, reported by Kevin Vandersloot.) * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): Clean up list == NULL handling and failure. --- ChangeLog | 12 ++++++++++++ ChangeLog.pre-2-0 | 12 ++++++++++++ ChangeLog.pre-2-10 | 12 ++++++++++++ ChangeLog.pre-2-2 | 12 ++++++++++++ ChangeLog.pre-2-4 | 12 ++++++++++++ ChangeLog.pre-2-6 | 12 ++++++++++++ ChangeLog.pre-2-8 | 12 ++++++++++++ gdk/x11/gdkselection-x11.c | 29 ++++++++++++++++++++--------- gtk/gtkmain.c | 5 ++++- 9 files changed, 108 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index e357064c65..159fdcdf24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index e357064c65..159fdcdf24 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e357064c65..159fdcdf24 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e357064c65..159fdcdf24 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e357064c65..159fdcdf24 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e357064c65..159fdcdf24 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e357064c65..159fdcdf24 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +Wed Feb 13 12:41:44 2002 Owen Taylor + + * gtk/gtkmain.c (gtk_init_check): g_warning() if setting + the local fails, like gdk_set_locale() did. + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_utf8_list): + Don't free local_list if local_count == 0. (#71241, reported + by Kevin Vandersloot.) + + * gdk/x11/gdkselection-x11.c (gdk_text_property_to_text_list): + Clean up list == NULL handling and failure. + Wed Feb 13 11:27:31 2002 Owen Taylor * tests/testtreeview.c (typesystem_recurse): Cast GType diff --git a/gdk/x11/gdkselection-x11.c b/gdk/x11/gdkselection-x11.c index 893d475ce1..def7c65930 100644 --- a/gdk/x11/gdkselection-x11.c +++ b/gdk/x11/gdkselection-x11.c @@ -305,21 +305,30 @@ gdk_text_property_to_text_list (GdkAtom encoding, XTextProperty property; gint count = 0; gint res; - - if (!list) - return 0; + gchar **local_list; property.value = (guchar *)text; property.encoding = gdk_x11_atom_to_xatom (encoding); property.format = format; property.nitems = length; - res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, list, &count); + res = XmbTextPropertyToTextList (GDK_DISPLAY(), &property, &local_list, &count); - if (res == XNoMemory || res == XLocaleNotSupported || - res == XConverterNotFound) - return 0; + if (res == XNoMemory || res == XLocaleNotSupported || res == XConverterNotFound) + { + if (list) + *list = NULL; + + return 0; + } else - return count; + { + if (list) + *list = local_list; + else + XFreeStringList (local_list); + + return count; + } } void @@ -482,8 +491,10 @@ gdk_text_property_to_utf8_list (GdkAtom encoding, (*list)[count++] = g_strdup (local_list[i]); } } + + if (local_count) + gdk_free_text_list (local_list); - gdk_free_text_list (local_list); (*list)[count] = NULL; return count; diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 37eb587fc9..a6d5c1975a 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -458,7 +458,10 @@ gtk_init_check (int *argc, #endif if (do_setlocale) - setlocale (LC_ALL, ""); + { + if (!setlocale (LC_ALL, "")) + g_warning ("Locale not supported by C library.\n\tUsing the fallback 'C' locale."); + } /* Initialize "gdk". We pass along the 'argc' and 'argv' * parameters as they contain information that GDK uses -- 2.30.2